#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

TOLUA_API int tolua_ppl_manual_open(lua_State* tolua_S);

#include "luaPPLManual.h"

static int tolua_ppl_manual_pplData_SearchLink(lua_State* L)
{
    pplData* self = (pplData*)tolua_tousertype(L, 1, 0);
    int r = lua_tonumber(L, 2);
    int c = lua_tonumber(L, 3);
    return self->SearchLink(L, r, c);
}

static int tolua_ppl_manual_pplData_SearchDrop(lua_State* L)
{
    pplData* self = (pplData*)  tolua_tousertype(L, 1, 0);
    return self->SearchDrop(L);
}

static int tolua_ppl_manual_pplData_Shoot(lua_State* L)
{
    pplData* self = (pplData*)  tolua_tousertype(L,1,0);
    CCPoint ptShoot = *((CCPoint*)  tolua_tousertype(L,2,0));
    CCPoint ptMouse = *((CCPoint*)  tolua_tousertype(L,3,0));

    return self->Shoot(L, ptShoot, ptMouse);
}

TOLUA_API int tolua_ppl_manual_open( lua_State* L )
{
    tolua_open(L);
    tolua_beginmodule(L, NULL);
        tolua_beginmodule(L, "pplData");
            tolua_function(L, "SearchLink", tolua_ppl_manual_pplData_SearchLink);
            tolua_function(L, "SearchDrop", tolua_ppl_manual_pplData_SearchDrop);
            tolua_function(L, "Shoot", tolua_ppl_manual_pplData_Shoot);
        tolua_endmodule(L);
    tolua_endmodule(L);

    return 1;
}
